package com.service.impl;

import com.entity.PageBean;
import com.entity.PurOrder;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mapper.PurOrderMapper;
import com.mapper.PurPayMapper;
import com.service.PurOrderService;
import com.service.PurPayService;
import com.vo.PurOrderVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PurPayServiceImpl implements PurPayService {
    @Autowired
    private PurPayMapper purPayMapper;


    @Override
    public PageBean<PurOrder> getPayList(Integer pageIndex, Integer pageSize, PurOrderVO purOrderVO) {
        PageHelper.startPage(pageIndex, pageSize);
        List<PurOrder> list= purPayMapper.selectPayList(purOrderVO);
        PageInfo<PurOrder> pageInfo = new PageInfo<>(list);
        PageBean<PurOrder> pageBean = new PageBean<>(
                pageIndex,//第几页
                pageSize,//每页显示的条数
                pageInfo.getPages(),//总页数
                (int)pageInfo.getTotal(),//数据总条数
                pageInfo.getList()//当前页的数据集合
        );
        return pageBean;
    }


    @Override
    public void updatePayList(PurOrder purOrder) {
        purPayMapper.updatePayList(purOrder);
    }


}
